package com.tree.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tree.backend.entity.pojo.ProductionEfficiency;
import com.tree.backend.entity.vo.InnovationCostData;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 生产效能记录表，记录各党组织对应的生产单元效能数据 Mapper 接口
 * </p>
 *
 * @author tree
 * @since 2025-10-15
 */
public interface ProductionEfficiencyMapper extends BaseMapper<ProductionEfficiency> {

    @Select("select record_month as \"months\",\n" +
            "    sum(innovation_count) as \"innovationCounts\",\n" +
            "    round(avg(cost_reduction_rate)*100,1) as \"costReductionRates\"\n" +
            "from production_efficiency\n" +
            "group by record_month;")
    List<InnovationCostData> costControl();
}
